package com.Cfeng.XiaohuanChat.controller;

import com.Cfeng.XiaohuanChat.domain.Resp;
import com.Cfeng.XiaohuanChat.entity.ChatUserRole;
import com.Cfeng.XiaohuanChat.service.ChatRoleService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Cfeng
 * @date 2022/8/7
 */

@RestController
@RequestMapping("/role")
@RequiredArgsConstructor
public class ChatRoleController {

    private final ChatRoleService roleService;

    @PostMapping("/addRole")
    public Resp<ChatUserRole> addRole(@Validated @RequestBody ChatUserRole role) {
        ChatUserRole chatUserRole = roleService.addRole(role);
        return Resp.ok(chatUserRole);
    }

}
